package IO流.IO流操作.处理流.字符缓冲流;

import java.io.*;


/**
 * 使用IO技术将aaa.txt文件拷贝一份
 */
public class Test {
    public static void fileCopy() {
        File file = new File("C:\\huangzhi\\workspace\\javaStudy\\src\\IO流\\IO流操作\\节点流\\inputStream和outputStream\\输入流\\aaa.txt");
        File copyFile = new File("C:\\huangzhi\\workspace\\javaStudy\\src\\IO流\\IO流操作\\节点流\\inputStream和outputStream\\输入流\\ii.txt");

        try (BufferedReader inputStream = new BufferedReader(new FileReader(file));
             BufferedWriter outputStream = new BufferedWriter(new FileWriter(copyFile))) {
            String line;
            while ((line = inputStream.readLine()) != null) {
                outputStream.write(line);
                outputStream.newLine();

            }
            outputStream.flush();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void main(String[] args) {
       Test.fileCopy();
    }
}
